<?php

/*
 * 产品属性类型编辑
 */

namespace Admin\Func;

class Func902020107 {

    var $db;
    var $rst;
    var $errmsg;
    var $ProductCode;
    var $ProductPropertyTypeID;
    var $ProductPropertyTypeName;
    var $ProductPropertyTypeSort;

    public function __construct($ProductCode, $ProductPropertyTypeID, $ProductPropertyTypeName, $ProductPropertyTypeSort) {
        $this->db = new \Think\Model();
        $this->errmsg = '';
        $this->ProductCode = addslashes($ProductCode);
        $this->ProductPropertyTypeID = addslashes($ProductPropertyTypeID);
        $this->ProductPropertyTypeName = addslashes($ProductPropertyTypeName);
        $this->ProductPropertyTypeSort = addslashes($ProductPropertyTypeSort);
    }

    /*
     * 获取错误信息
     */

    public function getErrMsg() {
        return $this->errmsg;
    }

    /*
     * 验证
     */

    private function validate() {
        return true;
    }

    /*
     * 执行
     */

    public function execute() {
        $vflag = true;
        $OperID = I('OperID');
        if ($this->validate()) {

            $sql = <<<EOD
UPDATE t_lz_ps_product_propertytype t
SET T.ProductCode = '$this->ProductCode',
T.ProductPropertyTypeID = '$this->ProductPropertyTypeID',
T.ProductPropertyTypeName = '$this->ProductPropertyTypeName',
T.ProductPropertyTypeSort = '$this->ProductPropertyTypeSort',

T.OperID = '$OperID',
T.OperDate = now()
WHERE T.ProductCode ='$this->ProductCode'
 AND  T.ProductPropertyTypeID = '$this->ProductPropertyTypeID'

EOD;

            //$this->rst = $this->db->query($sql);
            $this->rst = $this->db->execute($sql);
            if ($this->rst === false) {
                $this->errmsg = $this->db->getDbError();
                $vflag = false;
            } else {
                $vflag = true;
            }
        } else {
            $vflag = false;
        }
        return $vflag;
    }

    public function getRst() {
        return $this->rst;
    }

}
